package org.dromara.resource.api.feign;

import org.dromara.common.core.domain.R;
import org.dromara.resource.api.feign.fallback.ResourceMailFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import static org.dromara.common.core.constant.ServerNameConstants.RESOURCE_SERVER_NAME;

/**
 * @author: zhou shuai
 * @date: 2024/10/5 15:35
 * @version: v1
 */
@FeignClient(contextId = "resource-mail-api", name = RESOURCE_SERVER_NAME, fallbackFactory = ResourceMailFallBack.class)
public interface ResourceMailClient {

    /**
     * 发送邮件
     *
     * @param to      接收人
     * @param subject 标题
     * @param text    内容
     */
    @PostMapping(value = "/api/resource/mail/send")
    R<Void> sendMail(@RequestParam("to") String to, @RequestParam("subject") String subject,
                     @RequestParam("text") String text);

}
